﻿using System;
using System.Collections.Generic;
using Microsoft.Practices.Unity;

namespace Lbb.WSK
{
    public static class UnityServer
    {
        public readonly static IUnityContainer Container = new UnityContainer();

        #region UnityContainerExtensions
        public static IUnityContainer AddNewExtension<TExtension>() where TExtension : UnityContainerExtension
        {
            return Container.AddNewExtension<TExtension>();
        }
        public static T BuildUp<T>(T existing, params ResolverOverride[] resolverOverrides)
        {
            return Container.BuildUp<T>(existing, resolverOverrides);
        }
        public static T BuildUp<T>(T existing, string name, params ResolverOverride[] resolverOverrides)
        {
            return Container.BuildUp<T>(existing, name, resolverOverrides);
        }
        public static object BuildUp(Type t, object existing, params ResolverOverride[] resolverOverrides)
        {
            return Container.BuildUp(t, existing, resolverOverrides);
        }
        public static TConfigurator Configure<TConfigurator>() where TConfigurator : IUnityContainerExtensionConfigurator
        {
            return Container.Configure<TConfigurator>();
        }
        public static bool IsRegistered<T>()
        {
            return Container.IsRegistered<T>();
        }
        public static bool IsRegistered<T>(string nameToCheck)
        {
            return Container.IsRegistered<T>(nameToCheck);
        }
        public static bool IsRegistered(Type typeToCheck)
        {
            return Container.IsRegistered(typeToCheck);
        }
        public static bool IsRegistered(Type typeToCheck, string nameToCheck)
        {
            return Container.IsRegistered(typeToCheck, nameToCheck);
        }
        public static IUnityContainer RegisterInstance<TInterface>(TInterface instance)
        {
            return Container.RegisterInstance<TInterface>(instance);
        }
        public static IUnityContainer RegisterInstance<TInterface>(string name, TInterface instance)
        {
            return Container.RegisterInstance<TInterface>(name, instance);
        }
        public static IUnityContainer RegisterInstance<TInterface>(TInterface instance, LifetimeManager lifetimeManager)
        {
            return Container.RegisterInstance<TInterface>(instance, lifetimeManager);
        }
        public static IUnityContainer RegisterInstance(Type t, object instance)
        {
            return Container.RegisterInstance(t, instance);
        }
        public static IUnityContainer RegisterInstance<TInterface>(string name, TInterface instance, LifetimeManager lifetimeManager)
        {
            return Container.RegisterInstance<TInterface>(name, instance, lifetimeManager);
        }
        public static IUnityContainer RegisterInstance(Type t, object instance, LifetimeManager lifetimeManager)
        {
            return Container.RegisterInstance(t, instance, lifetimeManager);
        }
        public static IUnityContainer RegisterInstance(Type t, string name, object instance)
        {
            return Container.RegisterInstance(t, name, instance);
        }
        public static IUnityContainer RegisterType<T>(params InjectionMember[] injectionMembers)
        {
            return Container.RegisterType<T>(injectionMembers);
        }
        public static IUnityContainer RegisterType<TFrom, TTo>(params InjectionMember[] injectionMembers) where TTo : TFrom
        {
            return Container.RegisterType<TFrom, TTo>(injectionMembers);
        }
        public static IUnityContainer RegisterType<T>(LifetimeManager lifetimeManager, params InjectionMember[] injectionMembers)
        {
            return Container.RegisterType<T>(lifetimeManager, injectionMembers);
        }
        public static IUnityContainer RegisterType<TFrom, TTo>(LifetimeManager lifetimeManager, params InjectionMember[] injectionMembers) where TTo : TFrom
        {
            return Container.RegisterType<TFrom, TTo>(lifetimeManager, injectionMembers);
        }
        public static IUnityContainer RegisterType<TFrom, TTo>(string name, params InjectionMember[] injectionMembers) where TTo : TFrom
        {
            return Container.RegisterType<TFrom, TTo>(name, injectionMembers);
        }
        public static IUnityContainer RegisterType<T>(string name, params InjectionMember[] injectionMembers)
        {
            return Container.RegisterType<T>(name, injectionMembers);
        }
        public static IUnityContainer RegisterType(Type t, params InjectionMember[] injectionMembers)
        {
            return Container.RegisterType(t, injectionMembers);
        }
        public static IUnityContainer RegisterType<T>(string name, LifetimeManager lifetimeManager, params InjectionMember[] injectionMembers)
        {
            return Container.RegisterType<T>(name, lifetimeManager, injectionMembers);
        }
        public static IUnityContainer RegisterType<TFrom, TTo>(string name, LifetimeManager lifetimeManager, params InjectionMember[] injectionMembers) where TTo : TFrom
        {
            return Container.RegisterType<TFrom, TTo>(name, lifetimeManager, injectionMembers);
        }
        public static IUnityContainer RegisterType(Type t, LifetimeManager lifetimeManager, params InjectionMember[] injectionMembers)
        {
            return Container.RegisterType(t, lifetimeManager, injectionMembers);
        }
        public static IUnityContainer RegisterType(Type t, string name, params InjectionMember[] injectionMembers)
        {
            return Container.RegisterType(t, name, injectionMembers);
        }
        public static IUnityContainer RegisterType(Type from, Type to, params InjectionMember[] injectionMembers)
        {
            return Container.RegisterType(from, to, injectionMembers);
        }
        public static IUnityContainer RegisterType(Type t, string name, LifetimeManager lifetimeManager, params InjectionMember[] injectionMembers)
        {
            return Container.RegisterType(t, name, lifetimeManager, injectionMembers);
        }
        public static IUnityContainer RegisterType(Type from, Type to, LifetimeManager lifetimeManager, params InjectionMember[] injectionMembers)
        {
            return Container.RegisterType(from, to, lifetimeManager, injectionMembers);
        }
        public static IUnityContainer RegisterType(Type from, Type to, string name, params InjectionMember[] injectionMembers)
        {
            return Container.RegisterType(from, to, name, injectionMembers);
        }
        public static T Resolve<T>(params ResolverOverride[] overrides)
        {
            return Container.Resolve<T>(overrides);
        }
        public static T Resolve<T>(string name, params ResolverOverride[] overrides)
        {
            return Container.Resolve<T>(name, overrides);
        }
        public static object Resolve(Type t, params ResolverOverride[] overrides)
        {
            return Container.Resolve(t, overrides);
        }
        public static IEnumerable<T> ResolveAll<T>(params ResolverOverride[] resolverOverrides)
        {
            return Container.ResolveAll<T>(resolverOverrides);
        }
        #endregion UnityContainerExtensions

    }
}
